//
//  PayMoneyVC.m
//  BigJoy
//
//  Created by Rowling on 2017/7/11.
//  Copyright © 2017年 Rowling. All rights reserved.
//

#import "PayMoneyVC.h"
#import <AliPaySDK/AliPaySDK.h>

@interface PayMoneyVC ()

@end

@implementation PayMoneyVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"支付";
}
- (IBAction)aliPay:(id)sender {
//    [self aliPay];
}

-(void)aliPay {
    // 发起支付请求
        NSString * schemeStr = @"bigjoy";
    NSDictionary * dic = @{
                           @"order_num" : @"",
                           @"money" : @""
                           };
    [WYNetTool GET_Urlstring:AlipayUrl parameters:dic success:^(id responseObject) {
        
    } fail:^(id error) {
        
    }];
        [[AlipaySDK defaultService] payOrder:@"" fromScheme:schemeStr callback:^(NSDictionary *resultDic) {
            NSString *returnStr = @"订单处理成功";
            NSInteger orderState=[resultDic[@"resultStatus"] integerValue];
            if (orderState==9000) {
            }else{
                switch (orderState) {
                    case 8000:
                        returnStr=@"订单正在处理中";
                        break;
                    case 4000:
                        returnStr=@"订单支付失败";
                        break;
                    case 6001:
                        returnStr=@"订单取消";
                        break;
                    case 6002:
                        returnStr=@"网络连接出错";
                        break;
                    default:
                        break;
                }
            }
        }];
}

@end
